<template>
  <div class="search">
    <el-input
      v-model="searchContent"
      class="searchInput"
      @keyup.enter.native="search"
    ></el-input>
    <el-button
      type="info"
      icon="el-icon-search"
      class="searchBtn"
      @click.native="search"
    ></el-button>
    <el-button
      type="primary"
      class="addBtn"
      @click="showDialog"
      v-has="104"
      :disabled="!$store.state.btn_permission.includes('104')"
      >添加商品</el-button
    >
  </div>
</template>

<script>
export default {
  name: "search",
  data() {
    return {
      searchContent: "",
    };
  },
  methods: {
    search() {
      //列表接收重新请求更新数据  页面也要将currentPage改为1
      this.$bus.$emit("searchChange", this.searchContent);
    },
    showDialog() {
      this.$router.push("/goods/addGood");
    },
  },
};
</script>

<style  scoped>
.search {
  position: relative;
  overflow: hidden;
  height: 74px;
}
.searchInput ::v-deep .el-input__inner {
  position: absolute;
  left: 20px;
  height: 40px;
  width: 25%;
  border-radius: 0;
}
.searchBtn {
  position: absolute;
  left: calc(25% + 20px);
  height: 40px;
  top: 17px;
  border-radius: 0;
}
.addBtn {
  position: absolute;
  left: calc(25% + 20px + 60px);
  height: 40px;
  top: 17px;
  border-radius: 0;
}
</style>
